package com.travel.admin.exception;


/**
 *@desc: 异常处理
 */
public class TravelException extends RuntimeException {

    private static final long serialVersionUID = 5540484171361000892L;

    private TravelExceptionCode errorCode;

    private int code;

    public TravelException() {
        super();
        errorCode = TravelExceptionCode.SYSTEM_ERROR;
    }

    public TravelException(TravelExceptionCode exceptionCode) {
        super(exceptionCode.getDesc());
        errorCode = exceptionCode;
        //exceptionCode.setCustomMsg("");
    }

    public TravelException(TravelExceptionCode exceptionCode, Throwable e) {
        super(e.getMessage());
        errorCode = exceptionCode;
        //exceptionCode.setCustomMsg("");
    }

    public TravelException(TravelExceptionCode exceptionCode, String customMsg) {
        super(customMsg);
        //errorCode = exceptionCode;
        //exceptionCode.setCustomMsg(customMsg);
        code = exceptionCode.getErrorCode();
    }

    public TravelExceptionCode getErrorCode() {
        return errorCode;
    }

    public int getCode() {
        return code;
    }
}
